/**
 * gislin 2017年9月20日
 */
package com.btcode.orm.relation.ex;

import com.btcode.orm.model.IField;
import com.btcode.orm.model.IModel;

/**
 * @author gislin 2017年9月20日
 */
public class Join implements IJoin {

    private IField masterField;

    private IField slaveField;

    private boolean isNeedCache = false;

    private boolean isBridge = false;

    private boolean isNeedRelationDelete = false;

    public Join(IField masterField, IField slaveField) {
        this.masterField = masterField;
        this.slaveField = slaveField;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#isNeedCache()
     */
    @Override
    public boolean isNeedCache() {
        // TODO Auto-generated method stub
        return isNeedCache;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#isNeedRelationDelete()
     */
    @Override
    public boolean isNeedRelationDelete() {
        // TODO Auto-generated method stub
        return isNeedRelationDelete;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#setMasterField(com.bandit.orm.model.IField)
     */
    @Override
    public void setMasterField(IField masterField) {
        this.masterField = masterField;

    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#setSlaveField(com.bandit.orm.model.IField)
     */
    @Override
    public void setSlaveField(IField slaveField) {
        this.slaveField = slaveField;

    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getMasterField()
     */
    @Override
    public IField getMasterField() {
        return masterField;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getSlaveField()
     */
    @Override
    public IField getSlaveField() {
        return slaveField;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getMasterModelClass()
     */
    @Override
    public Class<IModel> getMasterModelClass() {
        return masterField.getModelClass();
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getSlaveModelClass()
     */
    @Override
    public Class<IModel> getSlaveModelClass() {
        return slaveField.getModelClass();
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getMasterTableName()
     */
    @Override
    public String getMasterTableName() {
        return masterField.getTableName();
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#getSlaveTableName()
     */
    @Override
    public String getSlaveTableName() {
        return slaveField.getTableName();
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.relation.ex.IJoin#isBridge()
     */
    @Override
    public boolean isBridge() {
        // TODO Auto-generated method stub
        return isBridge;
    }

    @Override
    public void setIsNeedCache(boolean isNeedCache) {
        this.isNeedCache = isNeedCache;

    }

    @Override
    public void setIsNeedRelateDelete(boolean isNeedRelateDelete) {
        this.isNeedRelationDelete = isNeedRelateDelete;

    }

    @Override
    public void setIsBridge(boolean isBridge) {
        this.isBridge = isBridge;

    }

}
